/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package session03;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author macbookpro
 */
public class CopyFile {

    public static void main(String[] args) {
        String file = "File.rtf";
        String copyFile = "Copy File.rtf";
        try {
            FileInputStream fis = new FileInputStream(file);

            FileOutputStream fos = new FileOutputStream(copyFile);

            int temp;

            while ((temp = fis.read()) != -1) {
                fos.write(temp);
            }

            fis.close();
            fos.close();
        } catch (FileNotFoundException ex) {
            Logger.getLogger(CopyFile.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(CopyFile.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
